//
//  ShellCoinViewController.m
//  ShellWallert
//
//  Created by lvzhao on 2020/5/10.
//  Copyright © 2020 VV. All rights reserved.
//

#import "ShellCoinViewController.h"
#import "ShellCoinView.h"
#import "ShellCoinViewModel.h"

@interface ShellCoinViewController ()

@property (nonatomic,strong) ShellCoinView *coinView;

@property (nonatomic,strong) ShellCoinViewModel *viewModel;

@end

@implementation ShellCoinViewController


- (instancetype)init
{
    self = [super init];
    if (self) {
        
        @weakify(self);
        [[[NSNotificationCenter defaultCenter] rac_addObserverForName:k_APPLanguageWillChangeNotificationName object:nil] subscribeNext:^(NSNotification * _Nullable x) {
            @strongify(self);
            self.title = LZLocalizedString(@"shell coin");
        }];
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"";
    [self setupUI];
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    //请求用户余额
    showLoadingTitle(@"", nil);
    [self.viewModel getCoinList:YES];
    [self.viewModel getShellCoin];
}

#pragma mark - setupUI
- (void)setupUI{
    [self.view addSubview:self.coinView];
    [self.coinView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(0);
    }];


}

#pragma mark - actions

#pragma mark - custool

#pragma mark - get && set
- (ShellCoinView *)coinView{

    if(!_coinView){
        _coinView = [[ShellCoinView alloc] initViewModel:self.viewModel];
    }
    return _coinView;
}

- (ShellCoinViewModel *)viewModel{
    if(!_viewModel){
        _viewModel = [[ShellCoinViewModel alloc] init];

    }
    return _viewModel;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
